<%@page import="java.util.HashMap"%>
<%@page import="java.util.Map"%>
<%@page import="com.situ.web.entity.Student"%>
<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<!-- 1、数据放到域对象中 -->
	<%
		pageContext.setAttribute("age", 23);
		pageContext.setAttribute("gender", "女");
	%>
	<c:set var="age" value="20"></c:set>
	
	<!-- 2、单条件判断 -->
	<c:if test="${age==20}">
		今年20岁了
	</c:if><br />
	<c:if test="${gender=='男'}">
		男
	</c:if>
	<c:if test="${gender=='女'}">
		女
	</c:if>
	<hr/>
	
	<!-- 3、多条件判断 -->
	<c:set var="score" value="65"></c:set>
	<c:choose>
		<c:when test="${score>=90&&score<=100}">
			优秀
		</c:when>
		<c:when test="${score>=80&&score<90}">
			良好
		</c:when>
		<c:when test="${score>=70&&score<80}">
			一般
		</c:when>
		<c:when test="${score>=60&&score<70}">
			及格
		</c:when>
		<c:otherwise>
			不及格
		</c:otherwise>
	</c:choose>
	
	<br/>
	<hr/>
	<!-- 4、集合遍历 
		4.1 List<String>
		4.2 List<Student>
		4.3 Map<String,String>   Map<String,Student>
	-->
	<c:forEach begin="0" end="10" var="i" step="3">
		${i}
	</c:forEach>
	<hr/>
	<%
		List<Student> list = new ArrayList<Student>();
		Student student1 = new Student(1, "芈月", 20, "女");
		Student student2 = new Student(2, "关羽", 21, "男");
		Student student3 = new Student(3, "赵云", 22, "男");
		list.add(student1);
		list.add(student2);
		list.add(student3);
		application.setAttribute("list", list);
	%>
	<c:forEach items="${list}" var="student">
		${student.name}---${student.age}---${student.gender}&nbsp;&nbsp;&nbsp;  
	</c:forEach>
	<!-- 
		Map<String,String>   Map<String,Student>
	 -->
	 <%
	 	Map<String,String> map = new HashMap<String,String>();
	 	map.put("cn", "中国");
	 	map.put("us", "美国");
	 	map.put("uk", "英国");
	 	request.setAttribute("map", map);
	 %>
	 <hr/>
	 <c:forEach items="${map}" var="entry">
	 	${entry.key}---${entry.value}&nbsp;&nbsp;&nbsp; 
	 </c:forEach>
	 <hr/>
	 <%
	 	Map<String,Student> map2 = new HashMap<String,Student>();
	 	Student stu1 = new Student(1, "露娜", 20, "女",1);
		Student stu2 = new Student(2, "典韦", 21, "男",2);
		Student stu3 = new Student(3, "白起", 22, "男",3);
		map2.put("stu1", stu1);
		map2.put("stu2", stu2);
		map2.put("stu3", stu3);
		application.setAttribute("map2", map2);
	 %>
	 <c:forEach items="${map2}" var="entry">
	 	${entry.key}---${entry.value}---${entry.value.name}<br />
	 </c:forEach>
</body>
</html>